<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>点击我</button>
    <div class="exchange"></div>
    <script>
        // 模板字符串
        let btn = document.querySelector("button");
        let  flag =true;
        btn.onclick = function(){
            flag = !flag;
            console.log(flag);
            var divele =`<div style="color:${flag?'red':'blue'}">我是你爸爸</div>`;
            document.querySelector(".exchange").innerHTML = divele;
        }
    
    </script>
</body>
</html>